
// --菜单模块请求---李春和-------------------------------------------
//#region
import request from '@/utils/request'
//获取菜单列表
export const getMenusListApi = () => {
    return request({
        url: "/menus",

    })
}
//获取菜单详情
export const getMenusInfoApi = (id) => {
    return request({
        url: "/menus/" + id,

    })
}
//添加菜单
export const addMenusApi = (data) => {
    return request({
        method: "post",
        url: "/menus",
        data,
    })
}
//修改菜单
export const updateMenusApi = (data) => {
    return request({
        method: "put",
        url: "/menus/" + data.id,
        data,
    })
}
//删除菜单
export const delMenusApi = (id) => {
    return request({
        method: "delete",
        url: "/menus/" + id,

    })
}
// 树形数据转成同级数据
export function treeToData(list) {
    let arr = []
    list.forEach(item => {
        arr.push(item)
        for (let k in item) {
            let arr2=[]
            if (Array.isArray(item[k])) {
               arr2= treeToData(item[k])
            }
            arr = [...arr, ...arr2]
        }
       
    })
  return arr
}

//#endregion
// --/菜单模块请求---李春和-------------------------------------------
